package 蓝桥算法;
import 队列.LinkedListQueue;
import 队列.Queue;

public class day12mystack {
  LinkedListQueue<Integer> queue=new LinkedListQueue<>(10);
   public void push(int x) {
       queue.offer(x);
       int size = queue.size;
       while (size-- > 1) {//确保好出栈的顺序
           queue.offer(queue.poll());
       }
   }
       public int pop(){
           return queue.poll();
       }
       public int top(){
       return queue.peek();
       }
       public boolean isEmpty(){
       return queue.isEmpty();
       }

    public static void main(String[] args) {
        day12mystack a=new day12mystack();
        a.push(1);
        a.push(2);
        a.push(3);
        for (int i = 0; i < 3; i++) {
            System.out.println(a.pop());
        }
    }
   }

